﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using BLL;
using DAL;
using System.Data;
using CrystalDecisions.CrystalReports.Engine;
using System.Web.Configuration;

public partial class Plublic_Report : System.Web.UI.Page
{
    String StrConn = WebConfigurationManager.ConnectionStrings["conn"].ConnectionString.ToString();
    ReportHandler objHandler = new ReportHandler();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserId"]==null)
        {
            Response.Redirect("Default.aspx");
        }
        
        DataTable dt = new DataTable();
        if (!IsPostBack)
        {
            dt = objHandler.GetData("select * from view_loginhistoty where UserID=" + Session["UserId"], StrConn);
            ViewState["LoginHistoty_Data"] = dt;
        }
        ReportDocument crystalReport = new ReportDocument();
        crystalReport.Load(Server.MapPath("~/Report/RptLoginHistory.rpt"));
        //dt = ViewState["LoginHistoty_Data"];
        CrystalReportViewer1.ReportSource = crystalReport;
        crystalReport.SetDataSource(ViewState["LoginHistoty_Data"]);
         
    }
    protected void Button1_Click(object sender, EventArgs e)
    {

    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        Response.Redirect("ReportLoginHistory.aspx");
    }
    protected void LinkButton3_Click(object sender, EventArgs e)
    {
        Response.Redirect("ReportTransactionDetails.aspx");
    }
}